package epam.bank.repository;

import epam.bank.domain.Invoice;
import org.springframework.stereotype.Repository;
import epam.bank.repository.api.IInvoiceRepository;

/**
 * Created with IntelliJ IDEA.
 * User: dima
 * Date: 10.03.13
 * Time: 1:56
 * To change this template use File | Settings | File Templates.
 */

@Repository("invoiceRepository")
public class InvoiceRepositoryImpl extends GenericCRUDRepositoryImpl<Invoice> implements IInvoiceRepository {

    public InvoiceRepositoryImpl() {
        super(Invoice.class);
    }

    @Override
    protected void beforeEntityDelete(Invoice entity) {
        executeUpdateQuery("Payment.deleteAllPayment", true, entity.getId());
    }
}
